package reflection.tij.finalstatic;

import static util.Print.*;

import java.lang.reflect.Field;

public class Reflection {
	public static void main(String[] args) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException, InterruptedException{
		A a = new A();
		print("Before: " + a);
		
		Class aClass = a.getClass();
		Field axField = aClass.getDeclaredField("x");
		print("Reflecting: " + axField.get(a));
		Thread.currentThread().sleep(1000);
		axField.setAccessible(true);
		axField.set(a, 100);
		print("Reflected: " + axField.get(a));
	}
}
